#include <vector>
#include <string>
using namespace std;
class Solution {
public:
    //利用bool数组来判断本行是否出现相同的数
    bool row_board[9][10];
    bool col_board[9][10];
    bool small_board[3][3][10];
    bool isValidSudoku(vector<vector<char>>& board) {
        for(int i = 0; i < board.size(); ++i)
            for(int j = 0; j < board[i].size(); ++j)
            {
                if(!isdigit(board[i][j])) continue;
                int index = board[i][j] - '0';
                if(row_board[i][index] || col_board[j][index] 
                || small_board[i / 3][j / 3][index])
                    return false;
                row_board[i][index] = col_board[j][index] = small_board[i / 3][j / 3][index] = true;
            }
        return true;
    }
};